package com.forever7776.life.core.mapper.collect;

import com.forever7776.life.core.entity.collect.CollectBlog;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 收藏表 Mapper 接口
 * </p>
 *
 * @author kz
 * @since 2018-04-11
 */
public interface CollectBlogMapper extends BaseMapper<CollectBlog> {

    /**
     * 修改博客点赞详细该条数据状态为：点赞
     *
     * @param userId
     * @param blogId
     * @return
     */
    @Update("update collect_blog set status=0 where user_id=#{userId} and blog_id=#{blogId}")
    int updateCollectBlogStatusCollect(@Param("userId") String userId, @Param("blogId") Integer blogId);

    /**
     * 修改博客点赞详细该条数据状态为：点赞
     *
     * @param userId
     * @param blogId
     * @return
     */
    @Update("update collect_blog set status=1 where user_id=#{userId} and blog_id=#{blogId}")
    int updateCollectBlogStatusNotCollect(@Param("userId") String userId, @Param("blogId") Integer blogId);

}
